from typing import NoReturn

__all__ = [
    # 常量
    'Fore', 'Back', 'Style',

    # 函数
    'ColorPrint'  # 彩色打印
]


class Fore:
    BLACK = 30
    RED = 31
    GREEN = 32
    YELLOW = 33
    BLUE = 34
    PURPLE = 35
    CYAN = 36
    WHITE = 37


class Back:
    BLACK = 40
    RED = 41
    GREEN = 42
    YELLOW = 43
    BLUE = 44
    PURPLE = 45
    CYAN = 46
    WHITE = 47


class Style:
    DEFAULT = 0
    HIGHLIGHT = 1
    UNDERLINE = 4
    BLINK = 5
    INVERT = 7
    UNLOOK = 8


def ColorPrint(String, forecolor: int = Fore.WHITE, bgcolor: int = Back.BLACK, style: int = Style.DEFAULT,
               end='\n') -> NoReturn:
    """
    :param String: 打印的消息 -> str
    :param forecolor: 字体颜色 -> int
    :param bgcolor: 背景颜色 -> int
    :param style: 样式 -> int
    :param end: Print.args.end -> str
    :return: NoReturn
    """
    PrString = Return_CPStr(String, bgcolor, forecolor, style)
    print(PrString, end=end)


def Return_CPStr(String, forecolor: int = Fore.WHITE, bgcolor: int = Back.BLACK, style: int = Style.DEFAULT):
    PrString = f"\033[{style};{forecolor};{bgcolor}m{String}\033[0m"
    return PrString
